<extend name="Base/base" />
<block name="body">
<div class="container">
</div>
</block>
<block name="js">
<script>
function jsApiCall()
{
  WeixinJSBridge.invoke(
      'getBrandWCPayRequest',
      {$jsApiParameters},
      function(res){
        WeixinJSBridge.log(res.err_msg);
        if (res.err_msg=='get_brand_wcpay_request:ok') {
          //支付
          window.location.href = "{$url}";
        } else {
          //alert(0);
        }                                                          
      }
    );
}

function callpay()
{
  if (typeof WeixinJSBridge == "undefined"){
    if( document.addEventListener ){
      document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
    }else if (document.attachEvent){
      document.attachEvent('WeixinJSBridgeReady', jsApiCall); 
      document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
    }
  }else{
    jsApiCall();
  }
}
$(function(){
  callpay();
});
</script>
</block>
